;(count-sum n) = (+ (count-sum (- n 1)) (- (count-sum (- n 2)) (count-sum (- n 3))) ...)

(defun count-sum(x)
  (cond ((= 1 x) 1)
	((> 1 x) 0)
	(t (loop 
	      for i from 1 to (1- x) 
	      sum (- (count-sum (- x i)) (count-sum (- x i 1)))))))

(defun next-sum(l)
  (cond ((


#|

1 1 2 4 6 10 14 21 28
    1 2 2  4  4  7  7
1 1
  1

2 1 
  1 1

3 2 = 1 + 1
  1 1 1
  2 1

4 4 = 2 + 1 + 1
  1 1 1 1
  2 1 1
  2 2
  3 1
  
5 6 = 4 + 1 + 1 = s4 + (s3 - s2) + 1
  1 1 1 1 1
  2 1 1 1
  2 2 1
  3 1 1
  3 2
  4 1
  
6 10 = 6 + 2 + 1 + 1 = s5 + (s4 - s3) + (s2 - s1) + 1
  1 1 1 1 1 1
  2 1 1 1 1
  2 2 1 1
  2 2 2
  3 1 1 1
  3 2 1
  3 3
  4 1 1
  4 2
  5 1
  
7 14 = 10 + 2 + 1 + 1 = s6 + (s5 - s4) + (s3 -s2) + 1
  1 1 1 1 1 1 1
  2 1 1 1 1 1
  2 2 1 1 1
  2 2 2 1
  3 1 1 1 1
  3 2 1 1
  3 2 2
  3 3 1
  4 1 1 1
  4 2 1
  4 3
  5 1 1
  5 2
  6 1

8 21 = 14 + 4 + 1 + 1 + 1 = s7 + s6 - s5 + s4 - s3 + s2 - s1 + 1
  1 1 1 1 1 1 1 1
  2 1 1 1 1 1 1
  2 2 1 1 1 1 
  2 2 2 1 1
  2 2 2 2
  3 1 1 1 1 1
  3 2 1 1 1
  3 2 2 1
  3 3 1 1
  3 3 2
  4 1 1 1 1
  4 2 1 1
  4 2 2
  4 3 1
  4 4
  5 1 1 1
  5 2 1
  5 3
  6 1 1
  6 2
  7 1 
  
9 28 = 21 + 3 + 2 + 1 = s8 + s7 - s6 + s5 - s4
  1 1 1 1 1 1 1 1 1
  2 1 1 1 1 1 1 1
  2 2 1 1 1 1 1
  2 2 2 1 1 1
  2 2 2 2 1
  3 1 1 1 1 1 1
  3 2 1 1 1 1
  3 2 2 1 1
  3 2 2 2
  3 3 1 1 1
  3 3 2 1
  3 3 3
  4 1 1 1 1 1
  4 2 1 1 1
  4 2 2 1
  4 3 1 1
  4 3 2
  4 4 1
  5 1 1 1 1
  5 2 1 1
  5 2 2
  5 3 1
  6 1 1 1
  6 2 1
  6 3
  7 1 1
  7 2
  8 1
#|